<div class='profile-wrap container clearfix'>
    <div class="tabbable tabs-left">
        <ul class="nav nav-tabs nav-pills">
        <li class="active"><a data-toggle="tab" href="#lA">Sơ lược</a></li>
        <?php if($_SESSION['UID'] == $_GET['id']): ?>        
        <li><a data-toggle="tab" href="#lB">Tài khoản</a></li>
        <li><a data-toggle="tab" href="#lC">Hoạt động</a></li>
        <?php endif; ?>
        </ul>
        <div class="tab-content">
        <div id="lA" class="tab-pane active">
            <div class="profile-inner">
                <div class="avatar-mask img-circle">
                    <img src="data/avatars/<?php echo $profile['Avatar'] ?>" />
                </div>
                <div class="brief">
                    <ul>
                        <li><i class="icon-user"></i><?php echo $profile['Fullname'] ?></li>
                        <li><i class="icon-th-large"></i><?php echo $profile['DoB'] ?></li>
                        <li><i class="icon-th-large"></i><?php echo $profile['Address'] ?></li>
                        <li><i class="icon-th-large"></i><?php echo $profile['Career'] ?></li>
                    </ul>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
        <?php if($_SESSION['UID'] == $_GET['id']): ?>
        <div id="lB" class="tab-pane">
            <div class="profile-inner">
                <div style="float: left; width: 200px">
                    <fieldset>
                        <legend><?php echo lang('LBL_AVATAR') ?></legend>
                    <?php echo form_open(
                            array(
                                'action' => getBaseUrl($_SERVER['REQUEST_URI']),
                                'enctype' => "multipart/form-data",
                                'id' => 'upload-avatar',
                                'method' => 'post',
                                'style' => 'text-align: center'
                                )
                            ); ?>
                    <div class="fileupload fileupload-new" data-provides="fileupload">
                    <div class="fileupload-new thumbnail" style="width: 200px; height: 200px;">
                        <!-- SRC=http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image -->
                        <img src="data/avatars/<?php echo $profile['Avatar'] ?>" /></div>
                    <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 200px; max-height: 200px; line-height: 20px;"></div>
                    <div>
                    <span class="btn btn-file">
                        <span class="fileupload-new">Select image</span>
                        <span class="fileupload-exists">Change</span>
                        <input name="avatar" type="file" /></span>
                    <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
                    </div>
                    <input type="submit" name="upload" value="Upload" class="btn-file btn btn-primary" style="width: 100%; margin-top: 5px" />
                    </div>                    
                    <?php echo form_close(); ?>
                    </fieldset>
                </div>
                <div style="float: left; margin-left: 10px;">
                    <?php if(!empty($errors)): ?>
                        <div class="alert alert-error">
                            <button class="close" type="button" data-dismiss="alert">&times;</button>
                            <?php
                            foreach($errors as $e)
                            {
                                echo "<p>{$e}</p>";
                            }
                            ?>
                        </div>
                    <?php endif; ?>         
                <fieldset>
                    <legend><?php echo lang('LBL_INFO_BASIC') ?></legend>
                    <?php if(!empty($messages)): ?>
                        <div class="alert alert-success">
                            <button class="close" type="button" data-dismiss="alert">&times;</button>
                            <?php
                            foreach($messages as $m)
                            {
                                echo "<p>{$m}</p>";
                            }
                            ?>
                        </div>
                    <?php endif; ?>               
                    <?php echo form_open(
                            array(
                                'action' => getBaseUrl($_SERVER['REQUEST_URI']),
                                'method' => 'post',
                                'class' => "form-horizontal"
                                )
                            ); ?>                
                        <div class="control-group">
                            <label class="control-label" for="fullname"><?php echo lang('LBL_FULLNAME')?></label>
                            <div class="controls">
                            <?php
                            echo form_input(
                                    array(
                                    'type' => 'text',
                                    'name' => 'profile[Fullname]',
                                    'id' => 'fullname',
                                    'max-length' => 50,
                                    'required' => 'required',
                                    'placeholder' => lang('PHD_FULLNAME'),
                                    'value' => (isset($profile['Fullname'])!=''?$profile['Fullname']:'')
                                        ))
                            ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="address"><?php echo lang('LBL_ADDRESS')?></label>
                            <div class="controls">
                            <?php
                            echo form_input(
                                    array(
                                        'type' => 'text',
                                        'name' => 'profile[Address]',
                                        'id' => 'address',
                                        'required' => 'required',
                                        'max-length' => '50',
                                        'placeholder' => lang('PHD_ADDRESS'),
                                        'value' => (isset($profile['Address'])!=''?$profile['Address']:'')
                            ))
                            ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="email"><?php echo lang('LBL_EMAIL')?></label>
                            <div class="controls">
                            <?php
                            echo form_input(
                                    array(
                                        'type' => 'email',
                                        'name' => 'profile[Email]',
                                        'id' => 'email',
                                        'required' => 'required',
                                        'max-length' => '50',
                                        'placeholder' => lang('PHD_EMAIL'),
                                        'value' => (isset($profile['Email'])!=''?$profile['Email']:'')
                            ))
                            ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="phone"><?php echo lang('LBL_PHONE')?></label>
                            <div class="controls">
                            <?php
                            echo form_input(
                                    array(
                                        'type' => 'text',
                                        'name' => 'profile[Phone]',
                                        'id' => 'phone',
                                        'required' => 'required',
                                        'max-length' => '50',
                                        'placeholder' => lang('PHD_PHONE'),
                                        'value' => (isset($profile['Phone'])!=''?$profile['Phone']:'')
                            ));
                            ?>
                            </div>
                        </div>
                        <div class="control-group">
                            <label class="control-label" for="career"><?php echo lang('LBL_CAREER')?></label>
                            <div class="controls">
                            <?php
                            echo form_input(
                                    array(
                                        'type' => 'text',
                                        'name' => 'profile[Career]',
                                        'id' => 'career',
                                        'required' => 'required',
                                        'max-length' => '50',
                                        'placeholder' => lang('PHD_CAREER'),
                                        'value' => (isset($profile['Career'])!=''?$profile['Career']:'')
                            ));
                            ?>
                            </div>
                        </div>
                        <div class="controls">
                        <button type="submit" class="btn btn-primary"><?php echo lang('LBL_UPDATE') ?></button>
                        <button type="button" class="btn">Cancel</button>
                        </div>
                    </form>
                </fieldset>  
                </div>
            </div>
        </div>

        <div id="lC" class="tab-pane">
            <div class="profile-inner">
            <p>Lần đăng nhập cuối: 19/06/2013</p>
            <p>Số bài chia sẻ: <?php echo $num_entries; ?></p>
            <p>Số lượt được bình chọn: <?php echo $num_votes; ?></p>
            </div>
        </div>
        <?php endif; ?>
        </div>
    </div>
    <script type="text/javascript">
    $('.nav-tabs').find('li').click(function(e){
        $('.profile-inner').hide().fadeIn(1000);
    });
    </script>
</div>